<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>edit</title>
    <link rel="stylesheet" th:href="@{/css/css.css}">
</head>
<body>

<form th:action="${#strings.equals(op,'新增子节点')?'/resource/create':'/resource/' + resource.id + '/update'}" id="resource"
      method="post">
    <input type="hidden" name="id" th:value="${resource.id}">
    <input type="hidden" name="parentId" th:value="${resource.parentId}">
    <input type="hidden" name="parentIds" th:value="${resource.parentIds}">
    <input type="hidden" name="available" th:value="${resource.available}">


    <div class="form-group" th:if="${parent!=null}">
        <label>父节点名称：</label>
        <span th:if="${parent!=null}" th:text="${parent.name}"></span>
    </div>

    <div class="form-group">
        <label><span th:if="${parent!=null}">子</span>名称：</label>
        <input type="text" name="name" th:value="${resource.name}">
    </div>

    <div class="form-group">
        <label>类型：</label>
        <select name="type">
            <option th:each="type:${types}" th:text="${type}" th:value="${type}"
                    th:selected="${#strings.equals(type,resource.type)}"></option>
        </select>
    </div>

    <div class="form-group">
        <label>URL路径：</label>
        <input type="text" name="url" th:value="${resource.url}">
    </div>

    <div class="form-group">
        <label>权限字符串：</label>
        <input type="text" name="permission" th:value="${resource.permission}">
    </div>

    <div class="form-group">
        <input type="submit" th:value="${op}">
    </div>

</form>


</body>
</html>